from django.contrib import admin
from .models import Film


@admin.register(Film)
class FilmAdmin(admin.ModelAdmin):
    """影票管理后台"""
    list_display = ['id', 'name', 'grade', 'runtime', 'category', 'filmType', 'recommend']
    list_filter = ['type', 'filmType', 'nation', 'recommend']
    search_fields = ['name', 'actors', 'synopsis']
    list_per_page = 20
    ordering = ['-recommend', '-id']

    fieldsets = (
        ('基本信息', {
            'fields': ('name', 'type', 'poster')
        }),
        ('电影信息', {
            'fields': ('grade', 'actors', 'nation', 'runtime', 'category', 'filmType')
        }),
        ('内容信息', {
            'fields': ('synopsis', 'photos')
        }),
        ('其他信息', {
            'fields': ('recommend', 'address', 'created_at')
        }),
    )
